<?php

use App\Models\Category;
use Illuminate\Support\Facades\Auth;

return [
    'title'=>'分类',
    'single'=>'分类',
    'model'=>Category::class,
    'action_permissions'=>[
        'delete'=>function(){
            return Auth::user()->hasRole('Founder');
        }
    ],
    'columns'=>[
        'id'=>[
            'title'=>'ID',
        ],
        'name'=>[
            'title'=>'分类名称',
            'sortable'=>false
        ],
        'description'=>[
            'title'=>'分类描述',
            'sortable'=>false,
        ],
        'operation'=>[
            'title'=>'管理',
            'sortable'=>false
        ]
    ],
    'edit_fields'=>[
        'name'=>[
            'title'=>'名称'
        ],
        'description'=>[
            'title'=>'分类描述'
        ],
    ],
    'filters'=>[
        'id'=>[
            'title'=>'分类ID'
        ],
        'name'=>[
            'title'=>'名称'
        ],
        'description'=>[
            'title'=>'描述'
        ]
    ],
    'rules'=>[
        'name'=>'required|between:2,100|unique:categories'
    ],
    'messages'=>[
        'name:unique'=>'分类名称不能重复',
        'name.required'=>'分类名称不能为空'
    ]
];
